import { stringify } from 'qs';
import request from '@/utils/request';

export async function goodsList(params) {
  return request(`/api/admin/goods/list?${stringify(params)}`, {
    method: 'get',
  });
}

export async function goodAdd(params) {
  return request('/api/admin/goods/add', {
    method: 'POST',
    body: params,
  });
}

export async function goodsdel(params) {
  return request('/api/admin/goods/del', {
    method: 'POST',
    body: {
      id: params.id,
    },
  });
}

export async function goodsremove(params) {
  return request('/api/admin/goods/remove', {
    method: 'POST',
    body: params,
  });
}

export async function brandlist(params) {
  return request(`/api/admin/brand/list?${stringify(params)}`, {
    method: 'get',
  });
}

export async function branddel(params) {
  console.log(params);
  return request('/api/admin/brand/del', {
    method: 'POST',
    body: {
      id: params.id,
    },
  });
}

export async function brandadd(params) {
  return request('/api/admin/brand/add', {
    method: 'POST',
    body: {
      name: params.name,
      c_name: params.c_name,
    },
  });
}

export async function brandupdate(params) {
  return request('/api/admin/brand/remove', {
    method: 'POST',
    body: {
      id: params.key,
      c_id: params.c_id,
      name: params.name,
    },
  });
}
